<template>
    <div class="fenlei">
        <h2>文章分类</h2>
        <ul>
            <li
                v-for="(ar,index) in article_sort"
                :key="index"
            ><a :href="'/list.html/'+ ar.id">{{ ar.name }}</a>
            </li>
        </ul>
    </div>
</template>

<script>
    import {getSort} from "../service/getData";

    export default {
        name: "sort",
        data() {
            return {
                article_sort: [
                    {
                        id: "1",
                        article_id: "100",
                        name: "心情",
                        sort_action: "/left",
                        sort_uid: "11"
                    },
                ],
                total: 1,
                currval: 1,
            }
        },
        methods: {
            sort_list: function () {
                getSort(this.currval).then((res) => {
                    this.article_sort = res.data.content;
                    this.total = res.data.totalPages;
                })
            },
            links: function () {
                this.$router.push({name: 'list', params: {sort_id: this.article_sort.id}})
            }
        }, mounted() {
            this.sort_list();
        }
    }
</script>
